package main
import (
	"fmt"
	"regexp"
)

func GetStr(body string)(result [][]string){
	reg := regexp.MustCompile(".*B0401.*")	//ed2k正则表达式规则
	if reg == nil{
		fmt.Println("正则表达式，编译错误：", reg)
		return
	}else{
		result = reg.FindAllStringSubmatch(body, -1)
		return result
	}
}

func main(){
	str := []string{
		"DataView.B0401.BMS_OPC.TaskID",
		"DataView.B04021.BMS_OPC.TaskID",
		"DataView.B04031.BMS_OPC.TaskID",
		"DataView.B0401.BMS_OPC.TaskID",
		"DataView.B04041.BMS_OPC.TaskID",
	}
	for _, data := range str{
		fmt.Println(GetStr(data))
	}
}